package com.linzm.template;

/**
 * @Author zimingl
 * @Date 2023/5/4 22:28
 * @Description: 饮料模板方法基类
 */
public abstract class AbstractDrinksTemplate {
    // 饮料名称
    protected String name;

    // 饮料价格
    protected String price;

    // 数量
    protected Integer count;

    public void setName(String name) {
        this.name = name;
    }

    public void setPrice(String price) {
        this.price = price;
    }

    public synchronized void setCount(Integer count) {
        this.count = count;
    }

    public synchronized void template() {
//        printName();
//        printPrice();
        printCount();
    }

    /**
     * 打印名称
     */
    protected abstract void printName();

    /**
     * 打印价格
     */
    protected abstract void printPrice();

    /**
     * 打印数量
     */
    protected abstract void printCount();
}
